<?php

/**
 * This file is part of ossecdb-extjs.
 * 
 * Copyright (C) 2011 Brendan Johnston
 * 
 * Contact: brendan@johnston.net.au
 * 
 * Project: http://code.google.com/p/ossecdb-extjs/
 * 
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
 */

if ($config['geolocation_enabled']) 
{
	if ($config['geolocation_method'] == 'maxmind_geolitecity_trigger') 
	{	
		$queries->alert_col['src_cntry'] = 'gls.country';
		$queries->alert_col['dst_cntry'] = 'gld.country';

		$queries->alert_from .= 
			'left join ow_alert_maxmind_geolitecity_location as g on a.id = g.alert_id ' . 
			'left join ow_maxmind_geolitecity_location as gls on g.src_location_id = gls.location_id ' . 
			'left join ow_maxmind_geolitecity_location as gld on g.dst_location_id = gld.location_id ';
	}
	else
	{
		ossec_response::nice_die('Sorry, unsupported geolocation method: ' . $config['geolocation_method']);
	}
}